import { defineStore } from 'pinia'
import { computed, reactive } from 'vue'

export const useReviewStore = defineStore(
    'review',
    () => {
        let reviewInfo = reactive({
            order_no: "",
            currency: "",
            amount: "",
            bank: "",
            branch: "",
            card_name: "",
            card_number: "",
            create_time: "",
        })
        let currentReviewInfo = computed(() => {
            return reviewInfo
        })
        const resetReviewInfo = reactive({ ...reviewInfo });
        // 
        function setReviewInfo(data) {
            Object.assign(reviewInfo, {...data});
        }

        function clearReviewInfo() {
            Object.assign(reviewInfo, resetReviewInfo);
        }

        return { reviewInfo, currentReviewInfo, setReviewInfo, clearReviewInfo }
    },
    {
        persist: true
    }

)